package com.jdk.mode.relate;

/**
 * @author jukg
 * @date 2023/08/28 14:13
 * @description 策略模式 接口定义规则，实现类具体实现
 */
public class Strategy {

}


interface CalculateStrategy{

    int calculate(int x, int y);
}

class AddCalculateStrategy implements CalculateStrategy{

    @Override
    public int calculate(int x, int y) {
        return x+y;
    }
}

class SubCalculateStategy implements CalculateStrategy{

    @Override
    public int calculate(int x, int y) {
        return x/y;
    }
}
